package hk.m4s.lr.repair.test.ui.user;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import framework.common.Constant;
import framework.common.baseui.UeBaseActivity;
import framework.common.zanetwork.core.ResponseCallback;
import framework.utils.SharedPreferencesUtils;
import hk.m4s.lr.repair.test.R;
import hk.m4s.lr.repair.test.model.MyOrderTuiModel;
import hk.m4s.lr.repair.test.model.SmSModel;
import hk.m4s.lr.repair.test.ui.adapter.TimeLineAdapter;
import okhttp3.Response;

/**
 * Created by qi.wang on 2017/5/4.
 *  物流信息
 */

public class OrderSmSActivity extends UeBaseActivity {
    private TextView order_sms_name;
    private TextView order_shop_state;
    private TextView order_sms_num;
    private TextView smsTips;
    private  ImageView order_shop_img;
    private MyOrderTuiModel.ListBean myOrderModel;
    private Context context;
    private ListView timelist;
    private List<SmSModel.ExpressBean.TracesBean> list=new ArrayList<>();
    private TimeLineAdapter timeLineAdapter;
    private String orderId="";
    private String type;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        baseSetContentView(R.layout.activity_sms_order);
        hiddenFooter();
        showGoBackBtn();
        context=this;
        setTitleText("物流详情");
        orderId=getIntent().getStringExtra("orderId");
        type=getIntent().getStringExtra("type");
        findbaseView();
    }
    public void findbaseView(){
        order_sms_name=(TextView)findViewById(R.id.order_sms_name);
        order_sms_num=(TextView)findViewById(R.id.order_sms_num);
        smsTips=(TextView)findViewById(R.id.smsTips);
        timelist= (ListView) findViewById(R.id.timelist);
        timeLineAdapter = new TimeLineAdapter(this,list);
        timelist.setAdapter(timeLineAdapter);
        //findExpress();
    }
//    public void findExpress() {
//        Map<String, Object> parmas = new HashMap<>();
//        parmas.put("device_type", Constant.device_type);
//        parmas.put("token", SharedPreferencesUtils.getSharedPreferences(Constant.token, ""));
//        parmas.put("userId", SharedPreferencesUtils.getSharedPreferences(Constant.userId, ""));
//        parmas.put("orderId",orderId);
//        parmas.put("type",type);
//        MyService.findExpress(context, parmas, new ResponseCallback<SmSModel>() {
//            @Override
//            public void onSuccess(SmSModel userinfoModel) {
//                if(userinfoModel!=null) {
//                    order_sms_name.setText("本数据来源于"+userinfoModel.getExpress().getShipperCode()+"物流公司");
//                    order_sms_num.setText(userinfoModel.getExpress().getLogisticCode());
//                    if(userinfoModel.getExpress().getTraces()!=null&&userinfoModel.getExpress().getTraces().size()>0){
//                        smsTips.setVisibility(View.GONE);
//                        list.addAll(userinfoModel.getExpress().getTraces());
//                        timeLineAdapter.notifyDataSetChanged();
//                    }else{
//                        smsTips.setVisibility(View.VISIBLE);
//                    }
//                }else{
//
//                }
//            }
//
//            @Override
//            public void onError(Response response, int errorCode, String errorMsg, Exception e) {
//
//            }
//        });
//    }
}
